
#include <unistd.h>

#include "test_server.h"

#include "../net/UDPServer.h"
#include "testUDPServer.h"

/** The UDP server in its default mode behaves as an echo server. This can be
 * tested by instantiation and using the corresponding UDP send client to probe
 * it behaviour.
 * 
 * @param hostname
 * Usually "0.0.0.0"
 * 
 * @param portno
 * Listening port.
 * 
 * @param mp
 * Memory pool to use. */
void tests::testUDPServer(const char *hostname, int portno, apr_pool_t *mp)
{
   UDPServer *udpserv = new UDPServer(1, portno, hostname, mp);
   udpserv->startSessionThreads();
   udpserv->startListeningThread();
   while (!allstop)
   {
      sleep(1);
   }
   delete udpserv;
}
